package xyz.bali16.module.menu.controller;

import com.gitee.starblues.core.descriptor.PluginDescriptor;
import xyz.bali16.module.menu.config.BasicConfig;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.annotation.Resource;

/**
 * 
 * @version 1.0
 * @since 2021-08-01
 */
@RestController
@RequestMapping("/hello")
@Api(tags = "basic1-plugin-hello")
public class HelloController {


    @Resource
    private BasicConfig basicConfig;
    @Resource
    private PluginDescriptor pluginDescriptor;


    @GetMapping
    public PluginDescriptor hello(){
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        System.out.println(attributes.getRequest().getRequestURI());
        return pluginDescriptor;
    }




    @GetMapping("/config")
    public BasicConfig getConfig(){
        return basicConfig;
    }

}
